<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/include/tagLib.jsp" %>
<!doctype html>
<html lang="en">
<head>
    <title>${sieName}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <%@include file="/include/cssLib.jsp" %>
</head>

<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12">
            <!-- 菜单 -->
            <tag:nav key="sysAdmin"/>

            <div class="tab-content">
                <div class="tab-pane active">
                    <div class="card col-md-10 col-md-offset-1">
                        <tag:sys-nav key="indexList"/>
                        <div class="card-content">
                            <div class="tab-content">
                                <div class="tab-pane active" id="profile">
                                    <div class="material-datatables">
                                        <table id="datatables" class="table table-bordered table-hover" cellspacing="0" width="100%" style="width:100%">
                                            <thead>
                                            <tr>
                                                <th>索引名称</th>
                                                <th>数量</th>
                                                <th>备注</th>
                                                <c:if test="${fns:isAdmin()}">
                                                    <th class="disabled-sorting text-center">操作</th>
                                                </c:if>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <c:forEach items="${list }" var="data">
                                                <tr>
                                                    <td>${data.indexName}</td>
                                                    <td>${data.indexTotal}</td>
                                                    <td></td>
                                                   <c:if test="${fns:isAdmin()}">
                                                        <td>
                                                            <a href="javascript:void(0);" onclick="reIndex('${data.indexName}');">重建索引</a>
                                                        </td>
                                                    </c:if>
                                                </tr>
                                            </c:forEach>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@include file="/include/sidebarRight.jsp" %>
</body>
<%@include file="/include/scriptLib.jsp" %>
<script type="text/javascript" src="${ctxStatic }/jquery-plugs/jquery.datatables.js"></script>

<script type="text/javascript">
    function reIndex(module){
        var title = '您确定要重建 '+module+" 的索引吗";
        dialogConfirm(title, function(){
            //url, paramArr, succCall, errorCall, beforeSendFun
            HttpUtil.ajaxAsyncJsonPost("/adminConsole/system/reIndex", {module: module}, function(message){
                dialogCenterTopTip(message);
                refreshPage(2000);
            }, function(){
                dialogTip('正在重建，请稍等...', 'info', 25000, 'c');
            });
        });
    }
</script>

</html>